package com.xunji.xunji.net;

import com.huanxiao.base.net.RespResult;
import com.xunji.xunji.module.account.bean.MyTrace;
import com.xunji.xunji.module.account.bean.TokenInfo;
import com.xunji.xunji.module.account.bean.UserInfo;

import java.util.List;
import java.util.Map;

import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
import rx.Observable;

/**
 * Created by paul on 16/10/18.
 */

public interface APIService {

    /**
     * 创建token
     *
     * @param param
     * @return
     */
    @GET("/userapi/token/create")
    Observable<RespResult<TokenInfo>> tokenCreate(@QueryMap Map<String, String> param);

    /**
     * 发送验证码
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/user/getVerifyCodeForRegister")
    Observable<RespResult> sendCode(@FieldMap Map<String, String> params);
    /**
     * 忘记密码发送验证码
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/user/getVerifyCodeForForgetPassword")
    Observable<RespResult> sendForgetCode(@FieldMap Map<String, String> params);

    /**
     * 登录
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/user/login")
    Observable<RespResult<String>> userLogin(@FieldMap Map<String, String> params);

    /**
     * 用户信息
     *
     * @param params
     * @return
     */
    @GET("/user/queryAllByPhone")
    Observable<RespResult<UserInfo>> userInfo(@QueryMap Map<String, String> params);

    /**
     * 更新头像信息
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/userapi/user/appportrait")
    Observable<RespResult<Object>> refreshHeadIcon(@FieldMap Map<String, String> params);

    /**
     * 登出
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/api/auth/logout")
    Observable<RespResult<Object>> loginOut(@FieldMap Map<String, String> params);


    /**
     * 实名认证
     *
     * @param params
     */
    @FormUrlEncoded
    @POST("/userapi/user/verify")
    Observable<RespResult<Object>> realNameAuthencation(@FieldMap Map<String, String> params);

    /**
     * 注册
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/user/register")
    Observable<RespResult> register(@FieldMap Map<String, String> params);


    /**
     * 重置密码
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/api/auth/resetPassword")
    Observable<RespResult> resetPswd(@FieldMap Map<String, String> params);

    /**
     * 重置密码
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/api/auth/changePassword")
    Observable<RespResult> changePswd(@FieldMap Map<String, String> params);


    /**
     * 实名认证
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/api/auth/certification")
    Observable<RespResult> authCertification(@FieldMap Map<String, String> params);


    /**
     * 检查token是否有效
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/api/auth/status")
    Observable<RespResult> authStatus(@FieldMap Map<String, String> params);

    /**
     * 绑定手机号
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/api/auth/verifyPhone ")
    Observable<RespResult>  authVerifyPhone(@FieldMap Map<String, String> params);


    @GET("https://hezi.tech/test/func/hello")
    Observable<String> getHttpsTest(@QueryMap Map<String, String> params);


    @FormUrlEncoded
    @POST("/api/auth/oauth ")
    Observable<RespResult<TokenInfo>> thirdLogin(@FieldMap Map<String, String> params);


    @FormUrlEncoded
    @POST("/track/createTrack")
    Observable<RespResult> createTrackAllInfo(@FieldMap Map<String, String> params);

    @GET("/track/queryByUserId")
    Observable<RespResult<List<MyTrace>>> queryAllByUserId(@QueryMap Map<String,String> params);


    @GET("/user/getQiniuUpToken")
    Observable<RespResult<String>> getQiniuUpToken(@QueryMap Map<String,String> params);
}
